package com.crud.test;

import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.servlet.ModelAndView;

@ControllerAdvice
public class HandlerException {

	@ExceptionHandler({ArithmeticException.class})
	public ModelAndView handlerArithmeticException(ArithmeticException ex) {
		ModelAndView mv = new ModelAndView("error");
		mv.addObject("exception",ex);
		System.out.println("-->出现异常了" + ex);
		return mv;
	}
	
}
